- Notifications
You must be signed in to change notification settings - Fork 5.8k
/
Copy path199. Binary Tree Right Side View_test.go
61 lines (48 loc) · 997 Bytes
/
199. Binary Tree Right Side View_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package leetcode
import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
)
typequestion199struct {
para199
ans199
}
// para 是参数
// one 代表第一个参数
typepara199struct {
one []int
}
// ans 是答案
// one 代表第一个答案
typeans199struct {
one []int
}
funcTest_Problem199(t*testing.T) {
qs:= []question199{
{
para199{[]int{}},
ans199{[]int{}},
},
{
para199{[]int{1}},
ans199{[]int{1}},
},
{
para199{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans199{[]int{3, 20, 7}},
},
{
para199{[]int{1, 2, 3, 4, structures.NULL, structures.NULL, 5}},
ans199{[]int{1, 3, 5}},
},
}
fmt.Printf("------------------------Leetcode Problem 199------------------------\n")
for_, q:=rangeqs {
_, p:=q.ans199, q.para199
fmt.Printf("【input】:%v ", p)
root:=structures.Ints2TreeNode(p.one)
fmt.Printf("【output】:%v \n", rightSideView(root))
}
fmt.Printf("\n\n\n")
}